﻿using System;
using ZHDJ.Data.Models.Center;
using ZHDJ.WebPage;

namespace ZHDJ.Web.Portal.BranchActivitie
{
    public partial class BranchActivitieDetail : PortalPage
    {
        /// <summary>
        /// 
        /// </summary>
        private string KeyID
        {
            get
            {
                return this.Request.QueryString["ID"] ?? "";
            }
        }

        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            PartyBranchActivitie activitie = DB.PartyBranchActivities.Find(this.KeyID);
            this.Title = activitie.Title;

            this.Title = activitie.Title;
            this.lblTitle.Text = activitie.Title;

            if (string.IsNullOrEmpty(activitie.RelationID))
            {
                if (activitie.CreateBy.Equals("D658070EC3BF425BA8417745FDCBFCB0"))
                {
                    this.lbCreateBy.Text = "天河智慧党建网";
                }
                else
                {
                    this.lbCreateBy.Text = ControlBusiness.GetBranchPickerText(activitie.BranchID);
                }
            }

            if (string.IsNullOrEmpty(activitie.ImageID))
            {
                this.trImg.Visible = false;
            }
            else
            {
                this.trImg.Visible = true;
                this.imgH.Src = UpFileBusiness.GetFileUrl(activitie.ImageID);
            }

            this.lbActivityTime.Text = Convert.ToDateTime(activitie.BeginTime).ToString("yyyy-MM-dd") + " 至 " + Convert.ToDateTime(activitie.EndTime).ToString("yyyy-MM-dd");
            this.lbAddress.Text = activitie.Address;
            this.lbContent.Text = activitie.SmsContent;
            this.lbRecord.Text = activitie.Record;
            this.lbParticipant.Text = PartyBranchActivitie.QueryActivityMembers(activitie.ID);
        }
    }
}